revision:
Syntax : $().jquery
The jquery property returns a string containing the jQuery version number.
Parameters: none
<div id="div1"> <button>Click me!</button> </div> <script> $(document).ready(function(){ $("#div1 button").on("click",function(){ var version = $().jquery; alert("You are running jQuery version: " + version); }); }); </script>
Syntax : jQuery.fx.interval = milliseconds;
The jQuery.fx.interval property is used to change the animation firing rate in milliseconds. The default value is 13 milliseconds. This property is often used to modify the number of frames per second at which animations will run. Lowering the firing rate can make animations to run smoother. However, it may cause performance and CPU implications.
Note: For any changes to this property to take effect, no animation should be running or all animations should be stopped first.
Note: This property has no effect in browsers that support the requestAnimationFrame property.
Parameters:
milliseconds : required. Specifies the animation firing rate in milliseconds. Default is 13 milliseconds
When the "Toggle div" button is pressed, we toggle between hiding and showing the div (default is 13 milliseconds). Each time the "Run animation with less frames" button is pressed, we add 500 milliseconds to the property, which causes the animation to run with less frames (depending on the browser, this may cause the animation to run less smoothly than desired).
Note: Since jQuery uses one global interval, for any changes to this property to take effect, no animation should be running or all animations should be stopped first (press "Toggle div". Then press "Run animation with less frames" when "div" is finished with the animation. When the animation has stopped, press "Toggle div" again to notice the effect).
<div id="div2"> <p>When the "Toggle div" button is pressed, we toggle between hiding and showing the div (default is 13 milliseconds). Each time the "Run animation with less frames" button is pressed, we add 500 milliseconds to the property, which causes the animation to run with less frames (depending on the browser, this may cause the animation to run less smoothly than desired).</p> <p><b>Note:</b> Since jQuery uses one global interval, for any changes to this property to take effect, no animation should be running or all animations should be stopped first (press "Toggle div". Then press "Run animation with less frames" when "div" is finished with the animation. When the animation has stopped, press "Toggle div" again to notice the effect).</p> <button id="toggle">Toggle div</button> <button id="interval">Run animation with less frames</button> <div style="background:#98bf21;height:10vw;width:10vw;margin:5vw;"></div> </div> <script> $(document).ready(function(){ $("#toggle").on("click", function(){ $("#div2 div").toggle(5000); }); $("#interval").on("click", function(){ jQuery.fx.interval = 500; }); }); </script>
Syntax : jQuery.fx.off = true|false;
The jQuery.fx.off property is used to globally disable/enable all animations. Default value is false, which allows animations to run normally. When set to true, all animation methods will be disabled, which will immediately set elements to their final state, instead of displaying an effect.
Tip: to shorten the code, it is possible to use $.fx.off instead of jQuery.fx.off.
Parameters:
true : specifies that animations should be disabled.
false : default. Specifies that animations should be enabled.
When the "Toggle animation" button is pressed, we toggle between hiding and showing the div with a slow animation. Press "Enable" or "Disable" to turn animations on and off.
<div id="div3"> <p>When the "Toggle animation" button is pressed, we toggle between hiding and showing the div with a slow animation. Press "Enable" or "Disable" to turn animations on and off.</p> <button id="disable">jQuery.fx.off = true ( Disable )</button> <button id="enable">jQuery.fx.off = false ( Enable )</button> <br><br> <button id="toggle">Toggle animation</button> <div style="background:#98bf21;height:100px;width:100px;margin:50px;"></div> </div> <script> $(document).ready(function(){ $("#div3 #disable").click(function(){ jQuery.fx.off = true; }); $("#div3 #enable").click(function(){ jQuery.fx.off = false; }); $("#div3 #toggle").click(function(){ $("#div3 div").toggle("slow"); }); }); </script>
Syntax :: jQuery.support.propvalue
The jQuery.support property contains a collection of properties representing different browser features or bugs. This property was primarily intended for jQuery�s internal use.
Parameters:
propvalue : required. Specifies the function to test for. The tests included are: ajax, boxModel, changeBubbles, checkClone, checkOn, cors, cssFloat, hrefNormalized, htmlSerialize, leadingWhitespace, noCloneChecked, noCloneEvent, opacity, optDisabled, optSelected, scriptEval(), style, submitBubbles, tbody
<div id="div4"> <p></p> </div> <script> $(document).ready(function(){ $("#div4 p").html("This browser can create XMLHttpRequest object: " + jQuery.support.ajax); }); </script>
Syntax : $(selector).length
The length property contains the number of elements in the jQuery object.
Parameters: none
<div id="div5"> <button>Alert the number of li elements</button> <ul> <li>Coffee</li> <li>Milk</li> <li>Soda</li> </ul> </div> <script> $(document).ready(function(){ $("#div5 button").click(function(){ alert($("#div5 li").length); }); }); </script>